#define _init__c

#include "includeAll.h"

void InitRegister()
{
	//base 14.7456
	TMOD = 0x11;				 //16bit timer0&timer1
	TH0 = (65536 - 14745) / 256; //2ms timer0 interrupt
	TL0 = (65536 - 14745) % 256;
	//TH1 = (65536-9676)/256;		//20ms timer1 interrupt
	//TL1 = (65536-9676)%256;
	RCP2H = TH2 = (65536 - 460) / 256; //0.125US timer2 interrupt
 	RCP2L = TL2 = (65536 - 460) % 256;
	IPH = 0x20;
	IP = 0x20;
	ET0 = 1; //timer0 interrupt enable
	TR0 = 1; //timer0 running
	// ET1 = 1; //timer1 interrupt enable
	//			 TR1 = 1;            //timer1 running
	ET2 = 1; //timer2 interrupt enable
	TR2 = 1; //timer2 running
	EA = 1;
}

void InitIoport()
{
	// #define seg5 P2_1
	// #define seg6 P2_0
	// #define seg7 P0_6
	// #define seg8 P3_2
	// #define seg9 P1_0
	// #define seg10 P1_1
	// #define seg11 P1_2
	// #define seg12 P1_3
	P0OE &= 0x00;
	P1MODL &= 0x00;
	P1MODH &= 0x00;
	P2MOD &= 0x00;
	P3MODL &= 0x00;
	P3MODH &= 0x00;
	P0ADIE = 0x00;

	P0OE |= b0000_0000;
	P1MODL |= b0000_0000;
	P1MODH |= b0000_0000;
	P2MOD |= b0000_0000;
	P3MODL |= b0000_0010;
	P3MODH |= b0000_0000;
	P0ADIE |= b0000_0000;


}

